import request from '@/utils/request'
import {parseStrEmpty} from "@/utils/ruoyi";

// 查询缓存详细
export function listCar(query) {
    return request({
        url: '/merchant/good/list',
        method: 'get',
        params: query
    })
}

export function listNotImeiCar(query) {
  return request({
    url: '/merchant/good/notImeilist',
    method: 'get',
    params: query
  })
}

export function addCar(info) {
  return request({
    url: '/merchant/good',
    method: 'post',
    data: info
  })
}

export function updateCar(info) {
  return request({
    url: '/merchant/good',
    method: 'put',
    data: info
  })
}

export function addGPS(info) {
    return request({
        url: '/gps',
        method: 'post',
        data: info
    })
}

export function updatePlatform(info) {
  return request({
    url: '/platform/gps',
    method: 'put',
    data: info
  })
}

export function addPlatform(info) {
  return request({
    url: '/platform/gps',
    method: 'post',
    data: info
  })
}

export function updateGPS(info) {
    return request({
        url: '/gps',
        method: 'put',
        data: info
    })
}

export function getCar(info) {
    return request({
        url: '/merchant/good/' + parseStrEmpty(info),
        method: 'get'
    })
}

export function filterCarList(query) {
  return request({
    url: '/merchant/good/filterImei',
    method: 'get',
    params:query
  })
}

export function delCar(info) {
    return request({
        url: '/merchant/good/' + info,
        method: 'delete'
    })
}

// 车辆主图上传
export function uploadVehicleAvatar(data) {
    return request({
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: '/merchant/good/upload/file',
        method: 'post',
        data: data
    })
}

// 车辆图片上传
export function uploadVehicleAttachs(data) {
    return request({
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: '/merchant/good/upload/files',
        method: 'post',
        data: data
    })
}

// 车辆行驶证上传
export function uploadDrivingPic(data) {
    return request({
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: '/merchant/good/upload/drivingPicFile',
        method: 'post',
        data: data
    })
}

// 车辆保险图片上传
export function uploadInsurancePic(data) {
    return request({
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: '/merchant/good/upload/insurancePicFile',
        method: 'post',
        data: data
    })
}

export function getGpsList(query) {
  return request({
    url: '/platform/gps/list',
    method: 'get',
    params: query
  })
}

export function getPersonList(query) {
  return request({
    url: '/gps/list?type=2',
    method: 'get',
    params: query
  })
}

// 车辆年检图片上传
export function uploadCheckPic(data) {15
    return request({
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        url: '/merchant/good/upload/checkPicFile',
        method: 'post',
        data: data
    })
}

export function delGPS(data) {
  return request({
    url: '/gps/'+data,
    method: 'delete'
  })
}

export function delPlatform(data) {
  return request({
    url: '/platform/gps/'+data,
    method: 'delete'
  })
}
